/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package entidades;

import java.io.Serializable;
import java.util.List;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.JoinColumn;
import javax.persistence.JoinTable;
import javax.persistence.ManyToMany;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;
import javax.persistence.OneToOne;

/**
 *
 * @author Samuel Lehotský <lehotsky at atlas dot sk>
 */
@Entity
public class Paciente extends Usuario {
    private static final long serialVersionUID = 1L;
    @Column(nullable = false)
    private int numSeguridadSocial;
    
    @OneToOne
    @JoinColumn(nullable = false)
    private HistoriaClinica hClinica;
    
    @OneToMany (mappedBy="paciente")
    @JoinColumn(nullable = false)
    private List<Cita> cita; 
    
    @ManyToMany
    @JoinTable(name = "Tabla_lista_paciente",
      joinColumns= @JoinColumn(name = "paciente_fk"),
      inverseJoinColumns= @JoinColumn(name = "lista_espera_fk"))
    private List<ListaDeEspera> lista_de_espera;
    
    @ManyToMany
    @JoinTable(name = "Consulta_informacion_medico",
      joinColumns= @JoinColumn(name = "paciente_fk"),
      inverseJoinColumns= @JoinColumn(name = "medico_fk"))
    private List<Medico> medico_consultable;
    
    @ManyToOne
    private Medico medico;
    
    public int getNumSeguridadSocial() {
        return numSeguridadSocial;
    }

    public void setNumSeguridadSocial(int numSeguridadSocial) {
        this.numSeguridadSocial = numSeguridadSocial;
    }
    
      @Override
    public int hashCode() {
        int hash = 7;
        hash = 71 * hash + this.numSeguridadSocial;
        return hash;
    }

    @Override
    public boolean equals(Object obj) {
        if (obj == null) {
            return false;
        }
        if (getClass() != obj.getClass()) {
            return false;
        }
        final Paciente other = (Paciente) obj;
        if (this.numSeguridadSocial != other.numSeguridadSocial) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "Paciente{" + "numSeguridadSocial=" + numSeguridadSocial + '}';
    }
    
}
